﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Common;
using BusinessEntity.Common;
using BusinessEntity.Patient;
using BusinessAction.Patient;

public class ProviderService : UpdateSession, IProviderService
 {
    SortableCollection<PatientVisit> IProviderService.SearchVisits(string sessionId, Patient oSearchPatient, out string successMessage, out string errorMessage)
    {
        successMessage = string.Empty;
        errorMessage = string.Empty;
        try
        {
            // Update user session
            base.UpdateUserSession(sessionId);

            ProviderManagement oProviderManagement = new ProviderManagement();
            return oProviderManagement.SearchVisits(sessionId, oSearchPatient, out successMessage, out errorMessage);

        }
        catch (Exception ex)
        {
            Utility.LogEmail(ex);
            errorMessage = Utility.GetExceptionMessageString(ex);
            return null;
        }
    }

    #region IProviderService Members


    SortableCollection<PatientVisit> IProviderService.AddVisit(string sessionId, Patient oPatient, out string successMessage, out string errorMessage)
    {
        successMessage = string.Empty;
        errorMessage = string.Empty;
        try
        {
            // Update user session
            base.UpdateUserSession(sessionId);

            ProviderManagement oProviderManagement = new ProviderManagement();
            return oProviderManagement.AddVisit(sessionId, oPatient, out successMessage, out errorMessage);

        }
        catch (Exception ex)
        {
            Utility.LogEmail(ex);
            errorMessage = Utility.GetExceptionMessageString(ex);
            return null;
        }
    }

    #endregion
 }

